﻿namespace OasisCiq.Xpil
{
    using System;
    using System.Linq;

    /// <summary>
    /// List of information types used for phone number details
    /// </summary>
    public class ContactNumberElementList : XS.XSNormalizedString
    {
        private static readonly string[] PossibleValues = new[] 
        {
            "CountryCode", // Code to dial to a country. E.g. 1 for US, 44 for UK
            "AreaCode", // Code to dial an area within a country. For example: "02" for Sydney, "03" for Melbourne
            "LocalNumber", // Local number as would be used by others within the same dialing area.
            "Extension", // An extension to the number that is usually handled by some PABX
            "Pin", // E.g. special access code
            "Separator", // Any text that is not part of the phone number, but has some informational content, e.g. Ext.
            "NationalNumber", // Area code with local number if one line. May include national access numbers.
            "InternationalNumber" // Full international number in one line. May include international access numbers.
        };

        public ContactNumberElementList(string value)
            : base(value)
        {
            if (!PossibleValues.Contains(value))
            {
                throw new ArgumentOutOfRangeException();
            }
        }
    }
}